import React from "react"
import { render } from "react-dom"
import { StyleSheet, Text, View, TextInput, ImageBackground } from 'react-native';


export default class MyInput extends React.Component {

    state = {
        text: ''
    }


    handleChangeText = text => {
        this.setState({
            text: text
        });
        

    }

    handleSubmitEditing=()=>{
        const { onSubmit } = this.props;
        onSubmit(this.state.text);
    }



    render() {
        return (
            <View>
                <TextInput
                    autoCorrect={false}
                    placeholder={this.props.placeholder}
                    onSubmit={this.props}
                    onSubmitEditing={this.handleSubmitEditing}
                    placeholderTextColor="white"
                    clearButtonMode="_always"
                    style={styles.textInputStyle}
                    onChangeText={this.handleChangeText} />
            </View>

        );
    }
}

const styles = StyleSheet.create({
    textInputStyle: {
        width: 300,
        height: 40,
        backgroundColor: '#666666',
        opacity: 0.75
    }

})